﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace PeteBrown.ConferenceTrivia.Controls
{
    public partial class TriviaItem : UserControl
    {
        public TriviaItem()
        {
            InitializeComponent();
        }

        public event EventHandler NextQuestion;

        public void StartQuestions()
        {
            Storyboard qa = Resources["DisplayQuestionAndAnswer"] as Storyboard;

            if (qa != null)
            {
                qa.Completed += (s, e) =>
                    {
                        if (NextQuestion != null)
                            NextQuestion(this, EventArgs.Empty);

                        qa.Begin();
                    };

                qa.Begin();
            }
        }
    }
}
